#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtGui>
#include <QSystemTrayIcon>
#include "ui_mainwindow.h"
#include "qtlen/tlen.h"

class messageclass : public QWidget // klasa rozmowy
{
        Q_OBJECT
    private:
    QPlainTextEdit* msgEditBox;
    QLineEdit* sendEditBox;
    QLabel* nameLabel;
    QVBoxLayout* layout;
    QCheckBox* checkBox;

    public:

        messageclass(QWidget *parent = 0);

        QString recipientName;
        QString msgRecipient;
        QString msgToSend;
        int index, autoBox;

        void setIn(QString,QString,int);
        void addMsg(QString);
        QString getJid();
        QString getName();

    signals:
        void mkMsg(QString,QString); // msg, jid
    public slots:
        void sendMsg();
        void setAutoBox(int);

};
class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
  //  Ui::MainWindow ui;
  //  tlen session;
    QList<messageclass*> chatList;
private:
    Ui::MainWindow ui;
    tlen session;
    QSystemTrayIcon* trayIcon;
    QSettings* settings;
    int visible;
    int loadSettings();
    void saveSettings();

private slots:
    void closeEvent(QCloseEvent *event);
    void aboutBox();
    void aboutBoxQt();
    void mkTrayIconCliced(QSystemTrayIcon::ActivationReason);
    void mkShowMail();
    void mkShowCore();
    // obsluga sesji
    void mkSetLogins();
    void mkSess();
    void mkSetPres(int a);
    void mkSetDesc();
    // obsluga listy kontaktow
    void mkAddToRoster(QString,QString,QString,QString,bool);
    void mkPresenceChanged(QString, QString, QString);
    void mkClearRoster();
    void mkSubscribeMsg(QString);
    void mkAddContactMsg();
    void mkAddContactMsg(QString);
    void mkRemoveContact();
    void mkEditContact();
    void mkRetryAuth();
    // obsluga wiadomosci
    void mkMessage(QString,QString);
    void mkSendMsg();
    void mkSelectRecipient(QTreeWidgetItem*,int);
    void mkMakeChat(QTreeWidgetItem*,int);
    void mkRemoveChat(int);
    // webkit
    void mkGoMail();
    void mkGoURL();
    void mkExitMail();
};


#endif // MAINWINDOW_H
